Add USB audio gadget permission setting#1479
Merged
Merged
Conversation
Contributor
|
FYI: this just bit me while I was rebasing my PRs: my CDC-NCM usb gadget was silently (partially) broken, because of too few available USB IN endpoints. The RX side was working fine, but the TX side didn't do anything (and I spent some time chasing phantom bugs). I'll add a UI warning to #1470 about exceeding the IN-endpoint budget to prevent users from making the same mistake in the future |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f13be06. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds USB Audio to the USB Devices setting as the explicit permission gate while keeping the live audio gadget enabled only when both USB Audio and Audio are enabled.
When USB Audio is disabled, Audio settings now disable the toggle and point users back to Hardware with a concise, inline hint.
Note
Medium Risk
Changes USB composite gadget composition and WebRTC audio attachment, which can trigger host re-enumeration; logic is covered by unit tests and coordinated RPC/config paths.
Overview
This PR adds USB Audio as an explicit permission in USB Devices, while the host only sees the audio gadget when both that toggle and Audio streaming are enabled.
Backend:
usbgadget.Devicesgains anaudioflag; gadget config and JSON-RPC (setUsbDevices,setUsbDeviceState,setAudioConfig) keepAudioEnabled, USB audio permission, and the live gadget in sync—disabling USB audio clears streaming config, stops audio, and reapplies the composite device viaeffectiveUsbDevices()/effectiveAudioEnabled(). Config load reads the file as raw JSON so older configs withoutusb_devices.audiopick up the new default and forceaudio_enabledoff when USB audio is off. WebRTC only attaches an audio track when both gates pass.UI: Hardware settings expose the USB Audio checkbox and updated presets; the Audio page disables its toggle with an inline hint linking to Hardware when USB Audio is off. Locales and a small e2e keyboard readiness check are updated.
Reviewed by Cursor Bugbot for commit 966d43f. Bugbot is set up for automated code reviews on this repo. Configure here.